import axios from 'axios'

const http = axios.create({
  baseURL: '/',// 基地址
  withCredentials: true //跨域照样协带cookie
})

// 请求拦截
http.interceptors.request.use(config => {
  return config;
}),error => {
  // 抛出错误
  return Promise.reject(error);
};

// 响应拦截
http.interceptors.response.use(response => {
  // 响应的数据 
  console.log('resopnse', response);
}),error => {
  // 抛出错误
  return Promise.reject(error);
}

export default http;